<template>
  <div>
    <!-- 条件渲染父级组件 -->
    <div v-if="!isChildRoute">
      <WMain />
      <WChart />
    </div>

    <!-- 条件渲染子路由内容 -->
    <div v-if="isChildRoute">
      <RouterView />
    </div>
  </div>
</template>

<script setup>
import { computed } from "vue";
import { useRoute } from "vue-router";

const route = useRoute();

// 判断当前路由是否为子路由
const isChildRoute = computed(() => {
  return route.name === "cityinfo";
});
</script>
